using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace sCicero
{
    public class AddValue
    {
        private string m_Display;
        private long m_Value;
        public AddValue(string Display, long Value)
        {
            m_Display = Display;
            m_Value = Value;
        }
        public string Display
        {
            get { return m_Display; }
        }
        public long Value
        {
            get { return m_Value; }
        }
    }

    public partial class DatabaseDebugger : Form
    {
        private sCicero.scicero m_osCicero;
        private sCicero.Data m_oData;

        public DatabaseDebugger(ref sCicero.scicero osCicero, ref sCicero.Data oData)
        {
            m_osCicero = osCicero;
            m_oData = oData;
            InitializeComponent();
            ArrayList Tables = new ArrayList();
            int nI = 0;
            foreach (DataTable oT in m_oData.m_oDataSet.Tables)
            {
                Tables.Add(new AddValue(oT.TableName, nI));
                nI++;
            }
            comboBox1.DataSource = Tables;
            comboBox1.ValueMember = "Display";
            comboBox1.DisplayMember = "Display";

            comboBox1.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged);
            //oCBc.DisplayMember = "name";
        }

        void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //DataView oW = m_osCicero.Classes.GetStudents(nClassId);
            dataGridView1.DataSource = m_oData.m_oDataSet.Tables[comboBox1.SelectedValue.ToString()].DefaultView;
            dataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader);
            dataGridView1.AllowUserToAddRows = false;
            dataGridView1.AllowUserToDeleteRows = false;
        }


    }
}